﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Marmat.Foundation;
using Marmat.Forms;
using Marmat.FrameWork;

namespace Marmat.Template.WinForm
{
    /// <summary>
    /// 成员控件
    /// </summary>
    public class AdvUserControl : Marmat.Forms.ComboBox
    {
        /// <summary>
        /// 初始化 Marmat.Template.WinForm.UserControl 类的新实例。
        /// </summary>
        public AdvUserControl()
        {
            if (!this.DesignMode)
            {
                if (SystemCommand.GetServiceProvider() is not null)
                {
                    IUserManager manager = Marmat.FrameWork.SystemCommand.GetService<IUserManager>();
                    if (manager is not null)
                    {
                        this.DataSource = manager.GetUserCollection();
                        this.ValueMember = nameof(IUserEntity.UserID);
                        this.DisplayMember = nameof(IUserEntity.NickName);
                    }
                }
            }
        }
    }
}
